{% extends "front/base.html" %}

{% block title %}知了Python论坛{% endblock %}

{% block head %}
  <link rel="stylesheet" href="{{ url_for('static',filename='front/css/index.css') }}">
{% endblock %}

{% block body %}
  <div class="lg-container">
    <div class="post-group">
      <ul class="post-list-group">
          {% for post in posts %}
        <li>
          <div class="post-info-group">
            <p class="post-title">
              <a href="{{ url_for('front.post_detail',post_id=post.id) }}">{{ post.title }}</a>
            </p>
            <p class="post-info">
              <span>作者: {{ post.author.username }}</span>
              <span>发表时间:{{ post.create_time }}</span>
              <span>评论:{{ post.comments.count() }}</span>
            </p>
          </div>
        </li>
          {% endfor %}
      </ul>
    {{ pagination.links }}
    </div>
  </div>
  <div class="sm-container">
    <div style="padding-bottom:10px;">
      <a href="{{ url_for("front.public_post") }}" class="btn btn-warning btn-block">发布帖子</a>
    </div>
    <div class="list-group">
        {% if current_board %}
            <a href="/" class="list-group-item">所有板块</a>
        {% else %}
            <a href="/" class="list-group-item active">所有板块</a>
        {% endif %}
    {% for board in boards %}
        {% if board_id == current_board %}
            <a href="{{ url_for('front.index',board_id=board.id) }}" class="list-group-item active">{{ board.name }}</a>
        {% else %}
        <a href="{{ url_for('front.index',board_id=board.id) }}" class="list-group-item">{{ board.name }}</a>>
        {% endif %}
        {% endfor %}
    </div>
  </div>
{% endblock %}